$(function () {
    //获取url
    var url = localStorage.getItem("ajaxUrl");
    var pass = 1;
    var type = "";

    //点击角色按钮,跳转到相应流程
    $("#work_list").on("click", "li p.p_role", function () {
        //console.log(sp_role);
        if ($(this).prev().find("span.sp_role").text() == "dailyinit_acid") {
            $(".mengceng").show();
            $("div.div_piWh").show();
        } else if ($(this).prev().find("span.sp_role").text() == "dailyinit_silk") {
            $("div.div_piCj select.shop").html('<option value="F01">一期车间</option><option value="F02">二期车间</option><option value="F03">三期车间</option>')
            $(".mengceng").show();
            $("div.div_piCj").show();
            type = $(this).prev().find("span.sp_role").text();
        } else if ($(this).prev().find("span.sp_role").text() == "dailyinit_heat") {
            $("div.div_piCj select.shop").html('<option value="F01">一期车间</option><option value="F02">二期车间</option>')
            $(".mengceng").show();
            $("div.div_piCj").show();
            type = $(this).prev().find("span.sp_role").text();
        } else if ($(this).prev().find("span.sp_role").text() == "dailyinit_steelRoll") {
            $("div.div_piCj select.shop").html('<option value="F03">三期车间</option>')
            $(".mengceng").show();
            $("div.div_piCj").show();
            type = $(this).prev().find("span.sp_role").text();
        } else if ($(this).prev().find("span.sp_role").text() == "dailyinit_material") {
            $(".mengceng").show();
            $("div.div_piMa").show();
            type = $(this).prev().find("span.sp_role").text();
        } else {
            window.location.href = "../html/" + $(this).prev().find("span.sp_role").text() + ".html";
        }
    });
    //点击 取消
    $("div.div_piWh .piWh_quxiao").on("click", function () {
        $(".mengceng").hide();
        $("div.div_piWh").hide();
    });
    //点击 确认
    $("div.div_piWh .piWh_queding").on("click", function () {
        var warehouse = $("div.div_piWh select.warehouse").val();
        if (!warehouse) {
            return $alert("请选择盘点的仓库");
        } else {
            localStorage.setItem("warehouse", warehouse)
            window.location.href = "../html/dailyinit_acid.html";
        }
    });

    //点击 取消
    $("div.div_piMa .piMa_quxiao").on("click", function () {
        $(".mengceng").hide();
        $("div.div_piMa").hide();
    });
    //点击 确认
    $("div.div_piMa .piMa_queding").on("click", function () {
        var warehouse = $("div.div_piMa select.warehouse").val();
        if (!warehouse) {
            return $alert("请选择盘点的仓库");
        } else {
            localStorage.setItem("warehouse", warehouse)
            window.location.href = "../html/" + type + ".html";
        }
    });

    //点击 取消
    $("div.div_piCj .piCj_quxiao").on("click", function () {
        $(".mengceng").hide();
        $("div.div_piCj").hide();
        type = "";
    });
    //点击 确认
    $("div.div_piCj .piCj_queding").on("click", function () {
        var shop = $("div.div_piCj select.shop").val();
        if (!shop) {
            return $alert("请选择盘点的车间");
        } else {
            localStorage.setItem("shop", shop)
            window.location.href = "../html/" + type + ".html";
        }
    });

});
